<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:body>
        <ui:composition template="./face-professor.xhtml">
            <ui:define name="content">
                <h1>Escolha o m&oacute;dulo</h1>

                <a href="_frmCadAluno.jsf">Aluno</a><br/>
                <a href="_frmCadProfessor.jsf">Professor</a><br/>
                <a href="_frmCadTipoTreino.jsf">Tipo de treinos</a><br/>
                <a href="_frmCadExercicio.jsf">Exerc&iacute;cios</a><br/>
                <a href="_frmCadTreino.jsf">Treino</a><br/>
                <a href="_frmLoginPessoa.jsf">Login</a>
            </ui:define>
        </ui:composition>
    </h:body>
    <p:growl id="growl" showDetail="true" />  
              
<h:form>  
  
    <p:fieldset id="container" legend="PrimeChat">  
  
        <h:panelGroup rendered="#{chatController.loggedIn}" >  
            <p:outputPanel layout="block" style="width:600px;height:200px;overflow:auto"   
                       styleClass="chatroom" />  
  
            <p:separator />  
  
            <p:inputText value="#{chatController.message}" styleClass="messageInput" />  
            <p:spacer width="5" />  
            <p:commandButton value="Send" actionListener="#{chatController.send}" global="false" oncomplete="$('.messageInput').val('').focus()"/>  
            <p:spacer width="5" />  
            <p:commandButton value="Disconnect" actionListener="#{chatController.disconnect}" global="false"   
                                oncomplete="chatAgent.close()" update="container" />  
        </h:panelGroup>  
  
        <h:panelGroup rendered="#{not chatController.loggedIn}" >  
            Username: <p:inputText value="#{chatController.username}" />  
  
            <p:spacer width="5" />  
            <p:commandButton value="Login" actionListener="#{chatController.login}" update="container"   
                             image="ui-icon ui-icon-person"/>  
        </h:panelGroup>  
  
    </p:fieldset>  
  
</h:form>  
  
<p:push onmessage="handleMessage" channel="chat" widgetVar="chatAgent"  />  
  
<script type="text/javascript">  
    function handleMessage(evt, data) {  
        var chatContent = $('.chatContent');  
        chatContent.append(data + '<br />');  
  
        //keep scroll  
        chatContent.scrollTop(chatContent.height());  
    }  
</script>
</html>

